<?php
$front = Zend_Controller_Front::getInstance()->getRequest();
$action = "/" . $front->getModuleName() . "/" . $front->getControllerName() ;
?>
<script type="text/javascript" >
function confirmDelete( id ) {
    var accion = 'eliminar';

    x=window.confirm('Esta segur@ que quiere ' + accion + ' este registro?');
    if (x){
      	location.href= "<?=$action?>/delete/id/" + id;
    }
    else{
		return false;
    }
    return true;
}
</script>

<h1>Zonas</h1>

<a class="button" href="/zone/create/" title="Agregar zona">
        <span >Agregar zona <img src="/imgs/plus.gif" width="9px"/></span>
</a>

<?php if (count($this->paginator)): ?>
<br/>
<?php echo $this->paginator ?>
<br/>
<div class="module">
<h2><span>Zonas</span></h2>
<div class="module-table-body">
<table class="tablesorter" cellpadding="0" cellspacing="0" border="0">
    <thead>
        <tr>
            <th class="header">Id</th>
            <th class="header">Nombre</th>
            <th class="header">Acciones</th>
        </tr>
    </thead>

    <tbody>
        <? $i=0; foreach ($this->paginator as $node) : ?>
        <tr class=<?php echo ($i%2==0?'"even"':'"odd"') ?>>
            <td> <?=$node['zone_id'] ?></td>
            <td><a href="/zone/list/id/<?=$node['zone_id'] ?>" class="tooltip" title="Ver sedes"><?=$node['name'] ?></a></td>
            <td>
					<?php if ($node['parent_id'] != 0){?>
                        <a onclick="confirmDelete( <?=$node['zone_id']?>);return false;" title="Borrar a <?=$node['name'] ?>" class="tooltip" href="#">
                            <img width="16" height="16" alt="comments" src="/imgs/minus-circle.gif">
                        </a>
                
                        <a title="Editar a <?=$node['name'] ?> " class="tooltip" href="/zone/update/id/<?=$node['zone_id']?>/">
                            <img width="16" height="16" alt="comments" src="/imgs/pencil.gif">
                        </a>
                     <?php }?>

            </td>
        </tr>
        <? $i++; endforeach; ?>
    </tbody>
</table>
</div>
</div>
    <?php echo $this->paginator ?>
<? endif; ?>

